﻿@using FluentUI.Demo.Shared.Pages.DataGrid.Examples
@using Microsoft.FluentUI.AspNetCore.Components

<FluentDataGrid Items="@people">
    <PropertyColumn Property="@(p => p.PersonId)" Sortable="true" Title="Identity">
        <HeaderCellTitleTemplate>
            <FluentStack Orientation="Orientation.Horizontal"
                         VerticalAlignment="VerticalAlignment.Center">
                <FluentIcon Icon="Icons.Regular.Size20.Person" />
                @context.Title
            </FluentStack>
        </HeaderCellTitleTemplate>
    </PropertyColumn>
    <PropertyColumn Property="@(p => p.Name)" Sortable="true" Title="Full _name" />
    <PropertyColumn Property="@(p => p.BirthDate)" Format="yyyy-MM-dd" Sortable="true">
        <HeaderCellTitleTemplate>
            <FluentStack Orientation="Orientation.Horizontal"
                         VerticalAlignment="VerticalAlignment.Center">
                <FluentIcon Icon="Icons.Regular.Size20.Calendar" />
                Birth date
            </FluentStack>
        </HeaderCellTitleTemplate>
    </PropertyColumn>
</FluentDataGrid>

@code {
    public class Person
    {
        public Person(int personId, string name, DateOnly birthDate)
        {
            PersonId = personId;
            Name = name;
            BirthDate = birthDate;
        }

        public int PersonId { get; set; }

        public string Name { get; set; }

        public DateOnly BirthDate { get; set; }
    }

    IQueryable<Person> people = new[]
    {
        new Person(10895, "Jean Martin", new DateOnly(1985, 3, 16)),
        new Person(10944, "António Langa", new DateOnly(1991, 12, 1)),
        new Person(11203, "Julie Smith", new DateOnly(1958, 10, 10)),
        new Person(11205, "Nur Sari", new DateOnly(1922, 4, 27)),
        new Person(11898, "Jose Hernandez", new DateOnly(2011, 5, 3)),
        new Person(12130, "Kenji Sato", new DateOnly(2004, 1, 9)),
    }.AsQueryable();
}